package com.ggleaf.spdemo.controller;

import org.springframework.util.NumberUtils;

import java.math.BigDecimal;

public class PriceUtil {

    /**
     * 打折券：提供一定的折扣，有9折优惠券。
     */
    public static  String coupon_type_discount ="1";

    /**
     * 满减券：消费达到一定金额后可以减免一部分，有满5000减100。
     */
    public static  String coupon_type_reduction ="2";


    public static Double discountPriceByCouponType(Double goodPrice, String couponType){
        if(goodPrice == null || couponType == null || couponType.equals("")){
           return null;
        }

        Double rePrice =goodPrice;
        // 9折
        if(coupon_type_discount.equals(couponType)){
            BigDecimal goodPriceBg = new BigDecimal(rePrice);
            //goodPriceBg.plus(0.9);
        }

        return rePrice;
    }


}
